<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
	<head>	
		<title>工作计划</title>
		<script type="text/javascript" src="<%=contextPath%>/js/validator.js"></script>
		<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript">
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
				       {
				            text: '保存',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:function(){
				            	comt();
				            }
				        },'-',
				        {
		            text: '提交',
		            icon:"<%=contextPath%>/" + "images/pass.gif",
		            hidden:<%=session.getAttribute("btn_add_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
		            handler:function() {
		            	toConfirm('1');
		            }
	        	},'-',
				        {
				            text: '返回',
				            icon:"<%=contextPath%>/images/fanhui.png",
				            handler:function(){
				            	back();
				            }
				        }
			    	]
			    });
			});
			
			function getprojectinfo(){
			window.open("<%=contextPath%>/projectImplement!findByUnitno.do", '统计表格', 'height=800, width=350, top=200, left=300, toolbar=no, menubar=no');
			// document.frmM.action = "<%=contextPath%>/projectImplement!findByUnitno";
			}
			
		</script>
	</head>
  
  <body topmargin="0">
  <div id = "tbar"></div>
  <center>
			<!-- 信息提示 -->
			<div result><font color="red">${info }</font></div>
		</center>
 		<form id="frmM" class="ct" name="frmM" method="POST" action="<%=contextPath%>/projectImplement!save.do">
 			<input type="hidden" id="hiddenids" name="hiddenids" value="${hiddenids}"/>
			<s:hidden name="entity.id" />	
			<s:hidden name="entity.ouid" />
			<s:hidden name ="entity.dwry"/>	
			<s:hidden name ="entity.ysr"/>	
			<s:hidden name ="entity.fzr"/>
			<s:hidden name="entity.status" />	
			<table width="100%"  id="infotab" >
			<tr>
					<th align="left" >变电站：</th>
					<td>
					<!--	<s:select list="bdzList" name="entity.stationid" width="300" listKey="id" listValue="bdzname"/>
							
						<input type="text" readonly="true" style="width:95%" datatype="Require" name="entity.stationname" value="${entity.stationname}" msg="变电站必须输入。" size="25"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="选择变电站" onClick="javascript:getBdzjx('entity.stationid','entity.stationname')" />
						<input type="hidden" name="entity.stationid" value="${entity.stationid}"/>-->
						<s:hidden name="entity.stationid"/>
						<input type="text" readonly="true" datatype="Require" name="entity.stationname" value="${entity.stationname}" msg="变电站必须输入。" />
						<img src="<%=contextPath%>/images/editlink.gif" title="选择变电站" onClick="javascript:getBdzselect('entity.stationid','entity.stationname')" />
			<th align="left" ><font color="red">*</font>停电范围：</th>
					<td>
						<s:textfield name="entity.powerrange"  datatype="Require" maxlength="100" size="50" msg="停电范围必须输入。" /></td>
					
				<!--  	<th >电压等级：</th>
					<td>
						<s:select list="dydjList" name="entity.voltagelevel" width="300" listKey="itemId" listValue="itemName"/>
					</td>-->
				</tr>
					<tr>
					<th width="18%" align="left" class="ct"> <font color="red">*</font>&nbsp;开始日期：</th>
					<td width="31%" >
				    	 <s:textfield name="entity.startdate" readonly="true"  datatype="Require" maxlength="50" size="25" msg="开始日期必须输入。" />
				    	 <img onclick="WdatePicker({dateFmt:'yyyy-MM-dd',el:$dp.$('entity.startdate')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
				     </td>
					<th width="22%" class="ct"><font color="red">*</font>&nbsp;结束日期：</th>
					<td width="29%" >
				       <s:textfield name="entity.enddate" readonly="true" datatype="Require" maxlength="50" size="25" msg="结束日期必须输入。" />
				        <img onclick="WdatePicker({dateFmt:'yyyy-MM-dd',el:$dp.$('entity.enddate')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
				    </td>
				</tr>
				<!--<th width="120" nowrap>
					开始时间：
					</th>
					<td>
						<input type="text"  onclick="WdatePicker({el:$dp.$('entity.startdate')})" name="entity.startdate" readonly="true" value='<fmt:formatDate value="${entity.startdate}" pattern="yyyy-MM-dd HH:mm"/>' msg="开始时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.startdate')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
				    <th width="120" nowrap>
					结束时间：
					</th>
					<td>
						<input type="text"  onclick="WdatePicker({el:$dp.$('entity.enddate')})" name="entity.enddate" readonly="true" value='<fmt:formatDate value="${entity.enddate}" pattern="yyyy-MM-dd HH:mm"/>' msg="开始时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.enddate')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>-->
				</tr>
				
				<tr>
					<th width="120" nowrap>
						总工作负责人：
					</th>
					<td>
						<!--<input type="text" style="width:50%" readonly="true" name="entity.responsible" value="${entity.responsible}" msg="负责人必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.fzr','entity.responsible','entity.bdz')" />
						-->
						<input type="text" style="width:50%" readonly="true" name="entity.responsible" value="${entity.responsible}" msg="负责人必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUserselect('entity.fzr','entity.responsible')" />
				
					</td>
					<th width="120" nowrap>
						施工方案：
					</th>
					<!--  <td>
						<c:if test="${entity.id != '0'}">
							<img style='cursor:pointer' onclick="filePopup('${entity.id}','TAB_PLAN_SGFA','0')" alt="打开附件列表" src="<%=contextPath%>/images/userfile.png" >
						</c:if>
						<c:if test="${entity.id == '0'}">
							&nbsp;<img src="<%=contextPath%>/images/redlight.gif"/><font color="red">请保存记录后上传录音</font>
						</c:if>
					</td>-->
					 <td>
					<select name="entity.sgfa" >
									<c:choose>
								<c:when test="${entity.sgfa == '' || entity.sgfa == null}">
									<option value="" selected></option>
									<option value="0">否</option>
									<option value="1">是</option>
								</c:when>
								<c:when test="${entity.sgfa == '0'}">
									<option value="" ></option>
									<option value="0" selected>否</option>
									<option value="1">是</option>
								</c:when>
								<c:when test="${entity.sgfa == '1'}">
									<option value="" ></option>
									<option value="0">否</option>
									<option value="1" selected>是</option>
								</c:when>
							</c:choose>
									</td>
				</tr>
				<!--  <tr>
					<th align="left" >停电范围：</th>
					<td>
						<s:textfield name="entity.powerrange" maxlength="50" size="25" /></td>
					<th>设备类型</th>
					<td>
						<s:select list="sblxList" name="entity.sblx" width="300" listKey="itemId" listValue="itemName"/>
				</tr>-->
				<tr>
					<th width="120" nowrap>
						验收人：
					</th>
					<td>
						<input type="text" style="width:50%" readonly="true" name="entity.ysrname" value="${entity.ysrname}" msg="验收人必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.ysr','entity.ysrname','entity.bdz')" />
					</td>
					<th width="120" nowrap>
						到位人员：
					</th>
					<td>
						
						<input type="text" style="width:50%" readonly="true" name="entity.dwryname" value="${entity.dwryname}" msg="到位人员必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.dwry','entity.dwryname','entity.bdz')" />
						
					</td>
				</tr>
				<!-- <tr>
					<th width="120" nowrap>
						外用工人数：
					</th>
					<td>
						<input type="text" style="width:50%"  name="entity.wyg" value="${entity.wyg}" msg="外用工人数必须输入。"/>
						</td>
					<th width="120" nowrap>
						车辆：
					</th>
					<td>
						
						<input type="text" style="width:50%"  name="entity.cxch" value="${entity.cxch}" msg="车辆必须输入。"/>
						
					</td>
				</tr> -->
				
				<tr>
					<th align="left" >&nbsp;工作项目：</th>
					<td colspan="3" >
						<textarea name="entity.workcontent" style="width:99%; height: 30px; min-height: 20px;line-height:15pt" min="0" datatype="LimitB"  min="1"   max="200"  datatype="Require"  msg="工作项目必须输入。" >${entity.workcontent}</textarea></td>
				</tr>
				<tr>
					<th align="left" >备注： </th>  
					<td colspan="3" >
						<textarea name="entity.remarks" style="width:99%; height: 30px; min-height: 20px;line-height:15pt" min="0" datatype="LimitB"  min="0"   max="200"   maxlength="50" size="25"  >${entity.remarks}</textarea></td>
				</tr>
			<tr>
					<th width="18%" align="left" class="ct"> &nbsp;隔日日期：</th>
					<td width="31%" >
				    	 <s:textfield name="entity.gr" readonly="true" maxlength="50" size="25"  />
				    	 <img onclick="WdatePicker({dateFmt:'yyyy-MM-dd',el:$dp.$('entity.gr')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
				     </td>
					<th width="18%" align="left" class="ct"> &nbsp;第一日日期：</th>
					<td width="31%" >
				    	 <s:textfield name="entity.dyr" readonly="true" maxlength="50" size="25"  />
				    	 <img onclick="WdatePicker({dateFmt:'yyyy-MM-dd',el:$dp.$('entity.dyr')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
				     </td>
				</tr>
			<hr>
			<table width="100%" id="listtab" class = "leadertab" >
				<tr><td colspan="4"> 工作组织 </td></tr>
				<tr>
					<th width="150">班组</th>
					<th width="150">负责人</th>
					<th>成员</th>
					<th>工作任务</th>
				</tr>

				<c:forEach items="${planbzList}" var="detail" varStatus="status">
					<tr id='tr${status.index}' class = "repeat">
						<td width="150" >
							<input type="hidden" id="planbzList[${status.index}].planid" name="planbzList[${status.index}].planid" value = "${detail.planid}"/>
							<input type="hidden" id="planbzList[${status.index}].id" name="planbzList[${status.index}].id" value = "${detail.id}"/>
							<input type="hidden" id="planbzList[${status.index}].delflag" name="planbzList[${status.index}].delflag" value = "${detail.delflag}"/>
							<input type="hidden" id="planbzList[${status.index}].bzid" name="planbzList[${status.index}].bzid" value = "${detail.bzid}"/>
							<input type="text" readonly="true" style="width:90%" id="planbzList[${status.index}].bzname" name="planbzList[${status.index}].bzname" value = "${detail.bzname}"/>
						</td>
						<td width="150">
							<input type="hidden" id="planbzList[${status.index}].fzrid" name="planbzList[${status.index}].fzrid" value = "${detail.fzrid}"/>
							<input type="text" readonly="true" style="width:80%" id="planbzList[${status.index}].fzrname" name="planbzList[${status.index}].fzrname" value = "${detail.fzrname}"/>
							<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('planbzList[${status.index}].fzrid','planbzList[${status.index}].fzrname','detail.bzid')" />
						</td>
						<td >
							<input type="hidden" id="planbzList[${status.index}].cyid" name="planbzList[${status.index}].cyid" value = "${detail.cyid}"/>
							<input type="text" readonly="true" style="width:80%" id="planbzList[${status.index}].cyname" name="planbzList[${status.index}].cyname" value = "${detail.cyname}"/>
							<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('planbzList[${status.index}].cyid','planbzList[${status.index}].cyname','detail.bzid')" />
						</td>
						<td >
							<input type="text"  style="width:80%" id="planbzList[${status.index}].gzrw" name="planbzList[${status.index}].gzrw" value = "${detail.gzrw}"/>
								</td>
					</tr>
				</c:forEach>
			
			</table>
		</table>
   </form>
  </body>
</html>
<script language="javascript">
	 // 保存
     function comt(){
        if(!Validator.Validate(frmM,1)){
			return false;
		}
     	document.frmM.action = "<%=contextPath%>/plan!saveMonthPlan.do";
     	document.frmM.submit();
     }
     
     // 返回
     function back() {
        location.href = "<%=contextPath%>/planList!getList.do?"
     }
 // 附件列表
	 function filePopup(id,colname,imageflag) {
		 var url = "<%=contextPath%>/jsp/common/fileTab.jsp?tableid=" + id + "&colname="+colname+"&imageflag="+imageflag;// "<%=contextPath%>/sb!test.do?id="+id;
		 var win = window.open(url,"图片列表","left=450,top=30,width=850,height=500,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=yes",true);
	}
		// 批准, 审核
		function toConfirm(flag)
		{
		
				var msg = flag == '1' ? '提交':'审核通过';
				
		    	if(confirm("确定要" + msg + "选中的记录吗？")) {
		        	document.frmM.action = "<%=contextPath%>/plan!saveMonthPlan.do?flag=" + flag;
					document.frmM.submit();
		    	}
		}
</script>
